Repository navigation
Conversation
Signed-off-by: Bhavya H <bhavya@labs.digiscrypt.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VirtualHostRuleContainerscopes the rules it groups to a configured set of virtual hosts, and for a*.foo.comentry it compares the configured domain with the part of the request server name that follows the first dot. The comparison is aString.regionMatchesover the length of the configured domain, so it checks only that the server name starts with that domain at that offset, never that it ends there.Host: vhost.foo.com.evil.comandHost: vhost.foo.comevil.comboth match*.foo.com, so every rule in the container runs for a host the deployment never configured, which matters when those rules rewrite paths, force request headers or set response headers for one tenant only.ContextHandler.VHost.matchesalready anchors its wildcard comparison at the end of the host name and limits the wildcard to one label, so the fix is to make the rewrite container agree with it and require the name after the first dot to be exactly the configured domain. The null check keeps the wildcard branch from throwing when a request carries no authority, which the oldserverName.indexOf(".")call did. I found it while comparing the two wildcard host matchers; the vectors added totestWildcardVirtualHostsfail before the change, and the jetty-rewrite suite (211 tests) and checkstyle are green after it.